home *** CD-ROM | disk | FTP | other *** search
/ What CD? 12 / What PC June 1997.iso / multi / cyber / cyber95 / _setup.1 / RIBHORN3.POP < prev    next >
Encoding:
Text File  |  1996-09-02  |  6.4 KB  |  219 lines

  1. // file : ribHorn3.pop
  2. // the ribHorn form has the same top level structure as a normal horn form,
  3. // but it's ribs are made up of reflected sub-horns.
  4. // this form extends ribHorn2 by adding functionality to toggle two
  5. // sub-horns.
  6.  
  7.  
  8. /////////////////////////////////
  9. // population display settings //
  10. /////////////////////////////////
  11.  
  12. population 0
  13. dimensions = 1
  14. colour_model RGB
  15. render_quality flat
  16.  
  17.  
  18. ////////////
  19. // genome //
  20. ////////////
  21.  
  22. genome 0 {
  23.  
  24.     ////////////////
  25.     // initialise //
  26.     ////////////////
  27.  
  28.     // initialise scaling
  29.     eggScale( 1 : 0.5 : 1 ),   // allow smaller primitives than standard
  30.     ratio( .2 : .1 : 1 ),
  31.  
  32.     // initialise material properties
  33.     setColour( hsv<.5,.5,.75> : hsv<0,.2,.5> : hsv<.99999,.99999,.99999> ),
  34.     setTexture( norder false:toggle ),
  35.     setBitmap( norder 0 : 0 : 20 ),
  36.     *setWrap( norder 0 : 0 : 2 ),
  37.  
  38.     ///////////////
  39.     // horn loop //
  40.     ///////////////
  41.  
  42.     for( 2 : 2 : 40,  0,   // mem[0] = #horn-segments
  43.  
  44.         // horn-segment code is made up of 2 distinct code blocks; the first block is executed
  45.         // within a new scope, called the "segment rib"; the second block is executed within
  46.         // the current scope and is called the "segment spine"
  47.         join(
  48.  
  49.             // mem[1] = mem[0] % 2
  50.             setScalarMem( 1, frac(div(getScalarMem(0),2)) ),
  51.             
  52.             /////////
  53.             // rib //
  54.             /////////
  55.             
  56.             scope(
  57.                 // rotate so that rib does not point in same direction as the spine
  58.                 rotate( <0,1.570796,0> : <0,-2,0> : <0,2,0> ),
  59.                 // move away from spine slightly
  60.                 forward( 0 : -3 : 3 ),
  61.                 // re-shape primitive
  62.                 eggVectorScale( <1,1,1> : <.75,.75,.75> : <1.25,1.25,1.25> ),
  63.                 // determine primitive type
  64.                 egg( 0 : 0 : 10 ),
  65.                 
  66.                 // lay an (enlarged) egg, (ie. visual for this spine segment)
  67.                 *scope(
  68.                     eggVectorScale( <1.5,1.5,1.5> : <1,1,1> : <10,10,10>),
  69.                     egg( 2 : 0 : 10 ),
  70.                     lay
  71.                 ),
  72.  
  73.                 // in this form the rib visually consists of a reflected sub-horn
  74.                 reflect( <1,1,-1> : <-1,-1,-1> : <1,1,1>,  
  75.                     ///////////////////////////
  76.                     // rib visual : sub horn //
  77.                     ///////////////////////////
  78.  
  79.                     ifElse( isMore( getScalarMem(1), 0 ),
  80.  
  81.                         ////////////////////////
  82.                         // sub-alternative #1 //
  83.                         ////////////////////////
  84.  
  85.                         join(
  86.                             // initialise material properties
  87.                             setColour( hsv<.5,.5,.75> : hsv<0,.2,.5> : hsv<.99999,.99999,.99999> ),
  88.                             setTexture( norder false:toggle ),
  89.                             setBitmap( norder 0 : 0 : 20 ),
  90.                             *setWrap( norder 0 : 0 : 2 ),
  91.  
  92.                             ///////////////
  93.                             // horn loop //
  94.                             ///////////////
  95.  
  96.                             repeat( 1 : 1 : 40,   // #sub-horn-segments
  97.                                 
  98.                                 // horn-segment code is made up of 2 distinct code blocks; the first block is executed
  99.                                 // within a new scope, called the "segment rib"; the second block is executed within
  100.                                 // the current scope and is called the "segment spine"
  101.                                 join(
  102.  
  103.                                     /////////////
  104.                                     // sub-rib //
  105.                                     /////////////
  106.  
  107.                                     // in this horn the rib visually consists of a single primtive
  108.                                     scope(
  109.                                         // rotate so that rib does not point in same direction as the spine
  110.                                         rotate( <0,0,0> : <-2,-2,-2> : <2,2,2> ),
  111.                                         // move away from spine slightly
  112.                                         forward( 0 : -2 : 2 ),
  113.                                         // re-shape primitive
  114.                                         eggVectorScale( <1,1,1> : <.75,.75,.75> : <1.25,1.25,1.25> ),
  115.                                         // determine primitive type and lay an egg
  116.                                         egg( 0 : 0 : 10 ),
  117.                                         lay
  118.                                     ),
  119.  
  120.                                     ///////////////
  121.                                     // sub-spine //
  122.                                     ///////////////
  123.  
  124.                                     // updates the turtle state ready for the next segment
  125.                                     move( <.5,0,0> : <-1,-1,-1> : <1,1,1> ),
  126.                                     scale( 1.05 : 1.01 : 1.1 ),
  127.                                     bankLeft( dtor(10 : -25 : 25) ),
  128.                                     noseUp( dtor(10 : -25 : 25) ),
  129.                                     moveHue( 0.03 : -0.08 : 0.08 ),
  130.                                     moveSat( 0.01 : -0.08 : 0.08 ),
  131.                                     moveVol( 0 : -0.2 : 0.2 ),
  132.                                     scale( 1 : 0.9 : 1.1 ),
  133.                                     moveRatio( 0 : -0.2 : 0.2 )
  134.                                 )
  135.                             )  // end sub-horn repeat loop
  136.                         ),  // end sub-horn-join block
  137.  
  138.                         ////////////////////////
  139.                         // sub-alternative #2 //
  140.                         ////////////////////////
  141.  
  142.                         join(
  143.  
  144.                             // initialise material properties
  145.                             setColour( hsv<.5,.5,.75> : hsv<0,.2,.5> : hsv<.99999,.99999,.99999> ),
  146.                             setTexture( norder false:toggle ),
  147.                             setBitmap( norder 0 : 0 : 20 ),
  148.                             *setWrap( norder 0 : 0 : 2 ),
  149.  
  150.                             ///////////////
  151.                             // horn loop //
  152.                             ///////////////
  153.  
  154.                             repeat( 1 : 1 : 40,   // #sub-horn-segments
  155.                                 
  156.                                 // horn-segment code is made up of 2 distinct code blocks; the first block is executed
  157.                                 // within a new scope, called the "segment rib"; the second block is executed within
  158.                                 // the current scope and is called the "segment spine"
  159.                                 join(
  160.  
  161.                                     /////////////
  162.                                     // sub-rib //
  163.                                     /////////////
  164.  
  165.                                     // in this horn the rib visually consists of a single primtive
  166.                                     scope(
  167.                                         // rotate so that rib does not point in same direction as the spine
  168.                                         rotate( <0,0,0> : <-2,-2,-2> : <2,2,2> ),
  169.                                         // move away from spine slightly
  170.                                         forward( 0 : -2 : 2 ),
  171.                                         // re-shape primitive
  172.                                         eggVectorScale( <1,1,1> : <.75,.75,.75> : <1.25,1.25,1.25> ),
  173.                                         // determine primitive type and lay an egg
  174.                                         egg( 0 : 0 : 10 ),
  175.                                         lay
  176.                                     ),
  177.  
  178.                                     ///////////////
  179.                                     // sub-spine //
  180.                                     ///////////////
  181.  
  182.                                     // updates the turtle state ready for the next segment
  183.                                     move( <-.5,0,0> : <-1,-1,-1> : <1,1,1> ),
  184.                                     scale( 1.05 : 1.01 : 1.1 ),
  185.                                     bankLeft( dtor(10 : -25 : 25) ),
  186.                                     noseUp( dtor(10 : -25 : 25) ),
  187.                                     moveHue( -0.03 : -0.08 : 0.08 ),
  188.                                     moveSat( 0.01 : -0.08 : 0.08 ),
  189.                                     moveVol( 0 : -0.2 : 0.2 ),
  190.                                     scale( 1 : 0.9 : 1.1 ),
  191.                                     moveRatio( 0 : -0.2 : 0.2 )
  192.                                 )
  193.                             )  // end sub-horn repeat loop
  194.                         )  // end sub-horn-join block
  195.                     )  // end ifElse
  196.                 )  // end reflect
  197.             ), // end rib-scope
  198.  
  199.             ///////////
  200.             // spine //
  201.             ///////////
  202.  
  203.             // updates the turtle state ready for the next segment
  204.             forward( 1 : -1 : 1 ),
  205.             scale( 1.05 : 1.01 : 1.1 ),
  206.             noseUp( dtor(10 : -25 : 25) ),
  207.             moveHue( 0.01 : -0.08 : 0.08 ),
  208.             moveSat( 0.03 : -0.08 : 0.08 ),
  209.             moveVol( 0 : -0.2 : 0.2 ),
  210.             scale( 1 : 0.9 : 1.1 ),
  211.             moveRatio( 0 : -0.2 : 0.2 )
  212.         )
  213.     )
  214. }
  215.  
  216.  
  217. // eof : ribHorn3.pop
  218.  
  219.